//获取所有图片展示

const express = require("express");
const route = express.Router();

//引入集合
const advModel = require("../mongoose/module/imgSchema");

route.get("/getImg", async (request, response) => {
  try {
    //去数据库查询所有数据
    const imgMsg = await advModel.find();
    console.log(imgMsg);
    response.send({
      data: imgMsg,
      code: 200,
      message: "请求成功",
    });
  } catch (error) {
    response.send({
      code: 201,
      message: error.message,
      data: null,
    });
  }
});

module.exports = route;
